import Vue from 'vue'
import VueRouter from 'vue-router'

// 登录组件
import Login from '@/views/Login.vue'
// 注册页面组件
import Reg from '@/views/Reg.vue'
// 架子组件
import Layout from '@/views/Layout'
import Home from '@/views/Layout/components/Home'
import ArtCategory from '@/views/Layout/components/ArtCategory'
import ArtList from '@/views/Layout/components/ArtList'
import UserInfo from '@/views/Layout/components/UserInfo'
import ChangeAvatar from '@/views/Layout/components/ChangeAvatar'
import ResetPwd from '@/views/Layout/components/ResetPwd'
Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    { path: '/login', component: Login },
    { path: '/reg', component: Reg },
    {
      path: '/',
      redirect: '/home',
      component: Layout,
      children: [
        { path: '/home', component: Home },
        { path: '/artcategory', component: ArtCategory },
        { path: '/artlist', component: ArtList },
        { path: '/userinfo', component: UserInfo },
        { path: '/changeavatar', component: ChangeAvatar },
        { path: '/resetpwd', component: ResetPwd }
      ]
    }
  ]

})

export default router

// eslint 是代码规范
// 1 不允许超过一个换行
// 2 禁止行尾出现分号
// 3 每一个文件的最后必须有一个空的换行
// 4 声明的变量必须使用
// ...
// const a = 100
// console.log(a)
// function fn () {
//   console.log(123)
// }
// fn()
// const a = 100
